<template>
	<view class="container">
		<uni-list v-for="item,index in list" :key="index">
			<uni-badge :text="item.count">
				<uni-list-item :thumb="'/static/images/school'+item.id+'.jpg'"
				:title="item.name" 
				:note="item.department"
				clickable="true" @click="toPage(item.id)"
				></uni-list-item>
			</uni-badge>
		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"list": []
			}
		},
		methods:{
			toPage(id){
				console.log(id);
				uni.navigateTo({   url:'../schooldetail/schooldetail?id='+id }) }
			
		},
		onLoad() {
					uni.showLoading({
						title: '加载中',
						mask: false
					});
					//urequest
					uni.request({
						url: 'http://localhost:8090/freshmenapp/user/list',
						method: 'POST',
						data: {},
						success: res => {
							console.log(res);
							this.list  =  res.data.list
							uni.showToast({
								title: '成功',
								icon: 'none'
							});
							setTimeout(()=>{
								uni.hideLoading()
							},2000)
						},
						fail: () => {
							uni.showToast({
								title: '失败',
								icon: 'none'
							});
						},
						complete: () => {}
					});
				}
	}
</script>

<style>
	/deep/.uni-badge {
		position: absolute;
		bottom: 10px;
		right: 5px;
	}
</style>